<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
    <title>美策平台</title>
    <link rel="icon" type="image/png" href="/img/icon.png">
    <link rel="stylesheet" type="text/css" href="../../datepicker/jquery-ui.min.css">
    <link rel="stylesheet" type="text/css" href="../../css/app.css">
    <link type="text/css" rel="stylesheet" href="../../css/loginMobile.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/my.css">
    <script type="text/javascript" src="../../js/jquery.min.js"></script>
    <script type="text/javascript" src="/h5/js/all.js"></script>
</head>
<body>
<!--
    制作者：九哥
    页面：我的信息
    时间：2019-03-23
    更新：
-->





<!---------- 我的信息 ---------->
<div id="settingPage">
    <div id="settingTitle">
        <b>我的信息</b>
        <img src="../../images/return.png" id="settingRtn">
    </div>
    <div class="myTable">
        <a href="/h5/my/touxiang/" >
            <div class="table-box">
                <div class="tableTitle touxiangbtn">
                    头像
                </div>
                <div class="arrow-box">
                    <b class="right">
                        <i class="right-arrow1"></i>
                        <i class="right-arrow2"></i>
                    </b>
                </div>
                <div id="head">
                    <img  >
                </div>
            </div>
        </a>
        <hr>
        <a href="javascript:;" onclick="getNickname()">
            <div class="table-box">
                <div class="tableTitle">
                    昵称
                </div>
                <div class="arrow-box">
                    <b class="right">
                        <i class="right-arrow1"></i>
                        <i class="right-arrow2"></i>
                    </b>
                </div>
                <div id="nickname"></div>
            </div>
        </a>
        <hr>
        <a href="javascript:;" onclick="getSexName()">
            <div class="table-box">
                <div class="tableTitle">性别</div>
                <div class="arrow-box">
                    <b class="right">
                        <i class="right-arrow1"></i>
                        <i class="right-arrow2"></i>
                    </b>
                </div>
                <div id="sexName"></div>
            </div>
        </a>
    </div>
    <div style="height:10px"></div>
    <p id="infoTitle"></p>
    <div class="myTable" id="info">

    </div>
    <div style="height:20px"></div>
</div>
<!---------- 我的信息 ---------->





<!-----------弹窗---------->
<div id="pop">
    <div id="popMask"></div>
    <div id="popDetail">
    </div>
</div>
<!-----------弹窗---------->

<!----------错误提示---------->
<div id="errMsg"></div>
<!----------错误提示---------->
</body>
<script type="text/javascript" src="../../js/app.js"></script>
<script type="text/javascript" src="../../js/mysetPageChange.js"></script>
<script type="text/javascript" src="../../js/myset.js"></script>
<script>
    (function(){

       //  getSettingInfoMenu(); //我的信息菜单
         getSettingUserInfo(); //获取用户昵称、头像、性别
        MC.user.info;

    })();

    //获取用户昵称、头像、性别
    function getSettingUserInfo(){
        var userInfo = cacheGet('userInfo'); //获取用户信息
        if (userInfo==null || userInfo.token=='undefined') {
            window.location.href = '/h5/login/login.html';
        }
        var data = {
            app_access:app_access,
            token:userInfo.token,
            type:userInfo.type,
            cate:userInfo.cate
        };
        $.ajax({
            type:'post',
            url:getDomain() + 'myset/userinfo',
            data:data,
            success:function(res){
                //console.log(res); return;
                if (res.code!=0) {
                    console.log(res); return;
                }
                var h = '', h2 = '', sex = res.data.sex;
                if (res.data.head!='') {
                    h += '<img src="'+res.data.head+'">';
                } else {
                    h += '<img src="../../images/user-default.png">';
                }
                $('#head').html(h);
                $('#nickname').html(res.data.nickname);
                if (sex==1) {
                    h2 += '男';
                } else if (sex==2) {
                    h2 += '女';
                } else {
                    h2 += '未定义';
                }
                $('#sexName').html(h2);
            },
            error:function(){
                console.log('操作失败！'); return;
            }
        });
    }
</script>
</html>